<template>
    <view
        @tap="__e"
        @touchmove.stop.prevent="__e"
        class="mask data-v-14502c63"
        :data-event-opts="[
            ['tap', [['cancel', ['$event']]]],
            ['touchmove', [['', ['$event']]]]
        ]"
    >
        <view @tap.stop.prevent="__e" class="mask-content data-v-14502c63" :data-event-opts="[['tap', [['', ['$event']]]]]" v-if="isInit && !isReturnSaleSuccess">
            <text @tap.stop.prevent="__e" class="new-iconfont icon-close close-btn data-v-14502c63" :data-event-opts="[['tap', [['cancel', ['$event']]]]]"></text>
            <view class="title data-v-14502c63">确认分解吗?</view>
            <view class="sku-list data-v-14502c63" :scrollY="true" v-if="$root.g0 <= 6">
                <view class="sku-c data-v-14502c63" v-for="(item, index) in skus" :key="index">
                    <view class="stock-c data-v-14502c63">{{ 'x' + item.total }}</view>

                    <image class="sku-thumb data-v-14502c63" mode="aspectFit" :src="item.thumb"></image>

                    <view class="sku-title data-v-14502c63">{{ item.title }}</view>

                    <view class="price-c data-v-14502c63">
                        <price-display @__l="__l" class="data-v-14502c63" :info="item" :vueId="'2be9ae96-1-' + index"></price-display>
                    </view>
                </view>
            </view>
            <scroll-view class="sku-list scroll-list data-v-14502c63" :scrollY="true" v-else>
                <view class="sku-c data-v-14502c63" v-for="(item, index) in skus" :key="index">
                    <view class="stock-c data-v-14502c63">{{ 'x' + item.total }}</view>

                    <image class="sku-thumb data-v-14502c63" mode="aspectFit" :src="item.thumb"></image>

                    <view class="sku-title data-v-14502c63">{{ item.title }}</view>

                    <view class="price-c data-v-14502c63">
                        <price-display @__l="__l" class="data-v-14502c63" :info="item" :vueId="'2be9ae96-2-' + index"></price-display>
                    </view>
                </view>
            </scroll-view>
            <view class="money-c data-v-14502c63">
                <view class="sub-title data-v-14502c63">{{ '当前折价率为' + info.return_sale_ratio + '，分解后你将获得:' }}</view>
                <view class="money item data-v-14502c63" v-if="info.return_money">
                    <view class="data-v-14502c63"></view>
                    <view class="number money data-v-14502c63">{{ info.return_money / 100 }}</view>
                    元
                    <view class="type data-v-14502c63">(原路退回)</view>
                </view>
                <view class="money item data-v-14502c63" v-if="info.return_redpack">
                    <view class="data-v-14502c63"></view>
                    <view class="number money data-v-14502c63">{{ info.return_redpack / 100 }}</view>
                    元
                    <view class="type data-v-14502c63">(退回余额)</view>
                </view>
                <view class="redpack item data-v-14502c63">
                    <view class="data-v-14502c63">{{ scoreAlias }}</view>
                    <view class="number score data-v-14502c63">{{ info.return_score }}</view>
                    个
                    <view class="type data-v-14502c63">(实时获得)</view>
                </view>
                <view class="tips data-v-14502c63">{{ '抽到' + scoreAlias + '、优惠券、红包等虚拟礼品不可分解' }}</view>
            </view>
            <view class="btn-c data-v-14502c63">
                <button @tap="__e" class="btn cancel bg-purple data-v-14502c63" :data-event-opts="[['tap', [['cancel', ['$event']]]]]">再想想</button>
                <button @tap="__e" class="btn submit bg-yellow data-v-14502c63" :data-event-opts="[['tap', [['submit', ['$event']]]]]">确认分解</button>
            </view>
        </view>
        <block v-else>
            <view @tap.stop.prevent="__e" class="data-v-14502c63" :data-event-opts="[['tap', [['', ['$event']]]]]" v-if="isReturnSaleSuccess">
                <view class="sku-c data-v-14502c63">
                    <image class="sku-thumb data-v-14502c63" mode="aspectFit" :src="sku.thumb"></image>
                    <view class="sku-title data-v-14502c63">{{ sku.title }}</view>
                </view>
            </view>
        </block>
    </view>
</template>

<script>
import priceDisplay from '@/components/PriceDisplay/PriceDisplay';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['components/ReturnSalePopup/ReturnSalePopup'],
    {
        1418: function (t, n, e) {},
        '4c93': function (t, n, e) {
            'use strict';

            var i = e('1418');
            e.n(i).a;
        },
        a5db: function (t, n, e) {
            'use strict';

            e.d(n, 'b', function () {
                return o;
            });
            e.d(n, 'c', function () {
                return u;
            });
            e.d(n, 'a', function () {
                return i;
            });
            var i = {
                PriceDisplay: function () {
                    return e.e('components/PriceDisplay/PriceDisplay').then(e.bind(null, '6b05'));
                }
            };
            var o = function () {
                this.$createElement;
                var t = (this._self._c, this.isInit && !this.isReturnSaleSuccess ? this.skus.length : null);
                this.setData(
                    Object.assign(
                        {},
                        {
                            $root: {
                                g0: t
                            }
                        }
                    )
                );
            };
            var u = [];
        },
        e268: function (t, n, e) {
            'use strict';

            e.r(n);
            var i = e('edca');
            var o = e.n(i);
            for (var u in i) {
                if (['default'].indexOf(u) < 0) {
                    (function (t) {
                        e.d(n, t, function () {
                            return i[t];
                        });
                    })(u);
                }
            }
            n.default = o.a;
        },
        edca: function (t, n, e) {
            'use strict';

            (function (t) {
                Object.defineProperty(n, '__esModule', {
                    value: true
                });
                n.default = void 0;
                var e = {
                    components: {},
                    data: function () {
                        return {
                            info: {},
                            skus: [],
                            isInit: false,
                            isReturnSaleSuccess: false
                        };
                    },
                    props: {
                        uuid: {
                            type: String
                        },
                        packageSku: {
                            type: Object
                        }
                    },
                    computed: {},
                    watch: {},
                    onLoad: function (t) {},
                    created: function () {
                        this.initOrder();
                    },
                    methods: {
                        initOrder: function () {
                            var that = this;
                            t.showLoading();
                            this.$http('/asset/return-sale/preview', 'post', {
                                ids: [this.packageSku.id]
                            }).then(function (e) {
                                that.isInit = true;
                                that.skus = e.data.skus;
                                that.info = e.data;
                                t.hideLoading();
                            });
                        },
                        cancel: function () {
                            this.$emit('cancel');
                        },
                        submit: function () {
                            var that = this;
                            t.showLoading();
                            this.$http('/asset/return-sale/confirm', 'post', {
                                ids: [this.packageSku.id]
                            }).then(function (e) {
                                that.isReturnSaleSuccess = 1;
                                t.showToast({
                                    title: '分解成功'
                                });
                                that.$emit('cancel');
                                that.$emit('refresh');
                            });
                        },
                        toPage: function (n) {
                            t.navigateTo({
                                url: n
                            });
                        }
                    },
                    onPageScroll: function (t) {}
                };
                n.default = e;
            }.call(this, e('543d').default));
        },
        f4ef: function (t, n, e) {
            'use strict';

            e.r(n);
            var i = e('a5db');
            var o = e('e268');
            for (var u in o) {
                if (['default'].indexOf(u) < 0) {
                    (function (t) {
                        e.d(n, t, function () {
                            return o[t];
                        });
                    })(u);
                }
            }
            e('4c93');
            var a = e('f0c5');
            var c = Object(a.a)(o.default, i.b, i.c, false, null, '14502c63', null, false, i.a, void 0);
            n.default = c.exports;
        }
    }
]);
(global.webpackJsonp = global.webpackJsonp || []).push([
    'components/ReturnSalePopup/ReturnSalePopup-create-component',
    {
        'components/ReturnSalePopup/ReturnSalePopup-create-component': function (t, n, e) {
            e('543d').createComponent(e('f4ef'));
        }
    },
    [['components/ReturnSalePopup/ReturnSalePopup-create-component']]
]);
</script>
<style>
@import './ReturnSalePopup.css';
</style>
